package com.yungu.swift.api.route.v2.driver;

import com.alibaba.dubbo.config.annotation.Reference;
import com.yungu.swift.assets.driver.model.param.HeatMapConfigParam;
import com.yungu.swift.assets.driver.model.param.HeatMapInfoParam;
import com.yungu.swift.assets.driver.model.vo.HeatMapConfigVo;
import com.yungu.swift.assets.driver.model.vo.HeatMapInfoVo;
import com.yungu.swift.assets.driver.service.DriverHeatMapService;
import com.yungu.swift.assets.driver.service.DriverService;
import com.yungu.swift.base.ResponseData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

/**
 * @author : cuixiuyin
 * @date : 2019/4/22
 */
@RestController
@RequestMapping(value = "/api/v2/driver/heat/map")
@Api(value = "【司机】热力图接口", tags = "热力图相关")
public class HeatMapApi {

    @Reference
    private DriverHeatMapService driverHeatMapService;
    @Reference
    private DriverService driverService;


    @RequestMapping(value = "/config", method = RequestMethod.POST)
    @ApiOperation(value = "热力图配置信息", notes = "热力图配置信息", response = ResponseData.class)
    public ResponseData<HeatMapConfigVo> getOrderHeatMap(@RequestHeader(value = "appid", required = false) String appid,
                                                         @RequestHeader(value = "token", required = false) String token,
                                                         @RequestBody HeatMapConfigParam configParam) {
        configParam.setAppid(appid);
        return driverHeatMapService.getHeatMapConfig(configParam);
    }

    @RequestMapping(value = "/info", method = RequestMethod.POST)
    @ApiOperation(value = "热力图详细信息", notes = "热力图详细信息", response = ResponseData.class)
    public ResponseData<HeatMapInfoVo> getNearOrderData(
            @RequestHeader(value = "appid", required = false) String appid,
            @ApiParam(name = "infoParam", value = "热力图详细信息参数", required = true) @RequestBody HeatMapInfoParam infoParam) {
        infoParam.setAppid(appid);
        return driverHeatMapService.getHeatMapInfo(infoParam);
    }

}
